/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.fjut.se1602.czq.MainTest;

import edu.fjut.se1602.czq.dao.impl.PetDaoImpl;
import edu.fjut.se1602.czq.dao.impl.PetOwnerDaoImpl;
import edu.fjut.se1602.czq.dao.impl.PetStoreDaoImpl;
import edu.fjut.se1602.czq.entity.Pet;
import edu.fjut.se1602.czq.entity.PetOwner;
import edu.fjut.se1602.czq.entity.PetStore;
import edu.fjut.se1602.czq.service.impl.PetOwnerServiceImpl;
import edu.fjut.se1602.czq.service.impl.PetServiceImpl;
import edu.fjut.se1602.czq.service.impl.PetStoreServiceImpl;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 *
 * @author asus
 */
public class main {

    public static void main(String[] args) {
        int i = 1, i1 = 1;
        // PetDaoImpl pdi = new PetDaoImpl();
        // PetOwnerDaoImpl podi = new PetOwnerDaoImpl();
        //PetStoreDaoImpl psdi = new PetStoreDaoImpl();
        PetServiceImpl psi = new PetServiceImpl();
        PetOwnerServiceImpl posi = new PetOwnerServiceImpl();
        PetStoreServiceImpl pssi = new PetStoreServiceImpl();
        List<Pet> allPets = new ArrayList();
        List<PetOwner> allOwners = new ArrayList();
        List<PetStore> allStores = new ArrayList();
        Scanner sc = new Scanner(System.in);
        allPets = psi.getPets();
        allOwners = posi.getOwners();
        allStores = pssi.getStores();
        System.out.println("宠物商店启动");
        System.out.println("Wonderland醒来，所有宠物从mysql中醒来");
        System.out.println("******************************************");
        for (Pet allPet : allPets) {
            System.out.println("第" + i + "个宠物,名字叫：" + allPet.getName());
            i++;
        }
        System.out.println("******************************************" + "\n");
        System.out.println("所有宠物主人从mysql中醒来");
        for (PetOwner allOwner : allOwners) {
            System.out.println("第" + i1 + "个主人,名字叫：" + allOwner.getName());
            i1++;
        }
        System.out.println("******************************************" + "\n");
        System.out.println("所有宠物商店从mysql中醒来");
        System.out.println("******************************************");
        for (PetStore allStore : allStores) {
            System.out.println("我的名字叫：" + allStore.getName());
        }
        System.out.println("******************************************" + "\n");
        System.out.println("请选择输入登录模式，输入1为宠物主人登录，输入2为宠物商店登录:");
        int type = sc.nextInt();
        if (type == 1) {
            System.out.println("请先登录，请您输入主人的名字：");
            String userName = sc.next();
            System.out.println("请先登录，请您输入主人的密码：");
            String userPassword = sc.next();
            posi.Login(userName, userPassword);
        } else if (type == 2) {
            System.out.println("请先登录，请您输入宠物商店的名字：");
            String userName = sc.next();
            System.out.println("请先登录，请您输入宠物商店的密码：");
            String userPassword = sc.next();
            pssi.Login(userName, userPassword);
        } else {
            System.out.println("输入错误！");
        }
    }
}
